/**
 * @author: sce
 * @description: 商品的评价
 */

import * as mongoose from 'mongoose';

const Schema = mongoose.Schema;

const EvaluationSchema = new Schema({
    // 商品ID
    commodity_id: {
        type: Schema.Types.ObjectId,
        required: true
    },
    // 评价类型
    type: {
        type: Number,
        required: true,
        // [踩， 文字评论， 顶]
        // enum: [-1, 0, 1]
    },
    // 评价内容
    message: {
        type: String,
        required: true
    },
    // 图片
    pics: {
        type: [String]
    },
    // 创建日期
    create_at: { type: Date, default: Date.now },
    // 更新日期
    update_at: { type: Date, default: Date.now }
});

mongoose.model('Evaluation', EvaluationSchema);